package main;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import face.FormAluno;
import face.FormDisciplina;
import face.FormProfessor;
import face.GridConceito;
import face.GridDiarioClasse;
 
public class Programa extends JPanel {
	
    public Programa() {
        super(new GridLayout(1, 1));
         
        JTabbedPane tabbedPane = new JTabbedPane();
        
        
        FormAluno formAluno = new FormAluno();
        JComponent panel3 = formAluno.card();
        tabbedPane.addTab("Alunos", null, panel3);
        tabbedPane.setMnemonicAt(0, KeyEvent.VK_3);
        
         
        JComponent panel2 = new GridConceito().card();
        tabbedPane.addTab("Conceito", null, panel2);
        tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

        JComponent panel1 = new GridDiarioClasse().card();
        tabbedPane.addTab("Diário de Classe", null, panel1);
        tabbedPane.setMnemonicAt(2, KeyEvent.VK_1);
        
        FormProfessor formProfessor = new FormProfessor();
        JComponent panel4 = formProfessor.card();
        tabbedPane.addTab("Professores", null, panel4);
        tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
        
        FormDisciplina formDisciplina = new FormDisciplina();
        JComponent panel5 = formDisciplina.card();
        panel5.setPreferredSize(new Dimension(410, 200));
        tabbedPane.addTab("Disciplinas", null, panel5);
        tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);
         
        //Add the tabbed pane to this panel.
        add(tabbedPane);
         
        //The following line enables to use scrolling tabs.
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    }
     
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("Sistema de acadêmico");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         
        //Add content to the window.
        frame.add(new Programa(), BorderLayout.CENTER);
         
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }
     
    public static void main(String[] args) {
    	//Cria base
//    	InitDataSource data = new InitDataSource();
//    	data.criarBase();
//    	data.importarBase();
    	
        //Cria e inicia a aplicação
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
        
        UIManager.put("swing.boldMetal", Boolean.FALSE);
        createAndShowGUI();
            }
        });
    }
    
	public static void die(Exception e) {
		e.printStackTrace(System.err);
		System.exit(1);
	}
    
    
}